package com.ywl.designpattern.decorator;
/**
 * 使用装饰模式
 */
public class DecoratorPatternDemo {
    public static void main(String[] args) {
        Coffee simpleCoffee = new SimpleCoffee();
        System.out.println("Cost: " + simpleCoffee.getCost() + "; Description: " + simpleCoffee.getDescription());

        Coffee milkCoffee = new MilkDecorator(new SimpleCoffee());
        System.out.println("Cost: " + milkCoffee.getCost() + "; Description: " + milkCoffee.getDescription());

        Coffee whipMilkSugarCoffee = new WhipDecorator(new MilkDecorator(new SugarDecorator(new SimpleCoffee())));
        System.out.println("Cost: " + whipMilkSugarCoffee.getCost() + "; Description: " + whipMilkSugarCoffee.getDescription());
    }
}
